#!/usr/bin/python
# -*- coding:utf-8 -*-
# @author  : micah
# @time    :  
# @function: 
# @version :


import pymysql


def update_data():
    db = pymysql.connect(host='localhost', port=3305, user='root', passwd='123456', db='python_test_1')
    cursor = db.cursor()

    sql = """
    update employee set sex='%s' where sex='%s';
    """ % ('女', '男')

    try:
        cursor.execute(sql)
        db.commit()
        print('数据修改成功...')
    except Exception as e:
        print('数据修改失败...', e)
    finally:
        cursor.close()
        db.close()


update_data()
